package com.yanqu.road.entity.activity.luckydraw;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.math.BigInteger;
import java.util.Map;

@FieldTypeAnnotation(tableName = "t_n_lucky_draw_record")
public class LuckyDrawRecord extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "渠道ID")
    private int channelId;
    @FieldTypeAnnotation(desc = "区服ID")
    private long serverId;
    @FieldTypeAnnotation(desc = "玩家ID")
    private long userId;
    @FieldTypeAnnotation(desc = "昵称")
    private String nickname;

    @FieldTypeAnnotation(desc = "奖励")
    private String reward;
    @FieldTypeAnnotation(desc = "道具ID")
    private int goodsId;
    @FieldTypeAnnotation(desc = "抽中时间")
    private long time;

    public LuckyDrawRecord() {
    }

    public LuckyDrawRecord(int activityId, int channelId, long serverId, long userId, String nickname, String reward, long time) {
        this.activityId = activityId;
        this.channelId = channelId;
        this.serverId = serverId;
        this.userId = userId;
        this.nickname = nickname;
        this.reward = reward;
        this.time = time;

        // 设置下道具ID
        Property property = PropertyHelper.parseStringToProperty(reward);
        for (Map.Entry<Integer, BigInteger> entry : property.getGoods().entrySet()) {
            goodsId = entry.getKey();
            break;
        }
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getChannelId() {
        return channelId;
    }

    public void setChannelId(int channelId) {
        this.channelId = channelId;
    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        this.serverId = serverId;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getReward() {
        return reward;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public int getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(int goodsId) {
        this.goodsId = goodsId;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }
}
